package j05bianyi;

public class J3throw {
    public static void main(String[] args) {
        //异常主动抛出，用户名密码
        String username = "admin";//admin
        String pass = "123456";//admin

        if(username=="admin" && pass=="admin"){
            System.out.println("登录成功！");
        }else{
            System.out.println("用户名密码错误！");
        }
    }
}
class J4throw {
    public static void main(String[] args) {
        //异常主动抛出，用户名密码
        String username = "admin";//admin
        String pass = "123456";//admin

        if(username=="admin" && pass=="admin"){
            System.out.println("登录成功！");
        }else{
            //主动抛出一个错误
            throw new RuntimeException("用户名密码错误");
        }

        System.out.println("===end===");
    }
}
